<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            height: 200px;
            background: blue;
            border: 6px solid red;
            font-size: 40px;
            text-align: center;
            line-height: 200px;
        }
    </style>
    <script>
       window.onload = init;
       function init() {
           window.setInterval("fn()",1000);
       }
       function fn() {
           var n = new Date();
           var obj = document.getElementById("div1");
           obj.innerHTML = "今天是"+":"+n.toLocaleString();
       }
    </script>
</head>
<body>
<div id="div1">
</div>
</body>
</html>